package entity.lemming.animation;

import java.awt.Point;

import entity.Entity;
import entity.lemming.Lemming;
import entity.terrain.Terrain;


/**
 * A simple animation to represent a lemming be crushed...
 * 
 * @author Neil Cowzer
 */
public class Crushed extends Lemming{
	/** current cycle or image of the lemming */
	private int cycle;

	
	/**
	 * Create an instance of a Lemming.
	 * 
	 * @param x intial x-coordinate of the lemming
	 * @param y intial y-coordinate of the lemming
	 */
	/*@ requires 0 <= x && 0 <= y;
	assignable speed_X && speed_Y && energy && startX;
	ensures speed_X == 0 && speed_Y < 0 && energy == 100;
 	@*/
	public Crushed(int x, int y){
		super ("resource/graphics/lemming/digger/digger_1.gif",8, x, y);
		cycle = 0;
		energy = 100;
	}
	
	/**
	 * Create a new Crushed Lemming with the given center point
	 * 
	 * @param center point of the Lemming
	 */
	public Crushed(Point center){
		super ("resource/graphics/lemming/digger/digger_1.gif",8, center);
		cycle = 0;
		energy = 100;
	}
	
	/** Request that this lemming perform the appropiate action/movement. */
	/*@ ensures x == \old(x) &&
	 * 			y == \old(y)&&
				energy == \old(energy);
	 @*/
	public void move(Terrain terrain) {
		if (cycle < 12){
			update();
		}
		else {
			alive = false;
		}
			cycle++;
	}
	
	/**
	 * Checks for a collision with certain Entities
	 * 
	 * @param other another Entity eg Terrain, Lemming.
	 * @return true if a collision has occured.
	 */
	public /*@ pure @*/ boolean collision(Lemming other) {
		return false;
	}
	
	/** Reverse a Lemmings direction */
	public void turnAround(){}
}
